<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <title>买入订单</title>
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}" media="all"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/news.css}" media="all"/>
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote news_search" style="min-width: 1680px;">
    <form id="searchForm" name="searchForm" class="layui-form" action="buyOrderEntry.html">
        <input type="hidden" id="pageNum" name="pageNum" th:value="${page.pageNum}"/>
        <input type="hidden" id="pageSize" name="pageSize" th:value="${page.pageSize}"/>
        <div class="layui-form-item" style="margin-left: -20px;margin-bottom: 2px;">
            <label class="layui-form-label">订单编号:</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="orderNo"/>
            </div>
            <label class="layui-form-label">用户名:</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="userName"/>
            </div>
            <label class="layui-form-label">产品名称:</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="productName"/>
            </div>
            <label class="layui-form-label">订单状态:</label>
        </div>
    </form>
</blockquote>
<div class="layui-form news_list" style="min-width: 1680px;text-align-all: center">
    <table class="layui-table">
        <thead>
        <tr>
            <th style="width: 180px;">订单编号</th>
            <th style="width: 272px;">机构编号</th>
            <th>机构名称</th>
            <th>机构Icon</th>
            <th>机构封面</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody class="news_content">
        <th:block th:if="${not #lists.isEmpty(page.list)}">
            <tr th:each="item:${page.list}">
                <td th:text="${item.id}"></td>
                <td th:text="${item.codes}"></td>
                <td th:text="${item.name}"></td>
                <td th:text="${item.images}"></td>
                <td th:text="${item.name}"></td>
                <td th:text="${item.name}"></td>
                <th:block th:switch="${item.states}">
                    <td th:case="0" style="color: #e47214">待支付</td>
                    <td th:case="1" style="color: #006400">支付成功</td>
                    <td th:case="2" style="color: #ff0000">支付失败</td>
                </th:block>
                <td th:text="${item.createTime}?${#dates.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                <!-- <td>
                    <a th:data="${item.orderId}" class="layui-btn layui-btn-mini message_edit"> <i class="layui-icon">&#xe642;</i>编辑</a>
                    <th:block th:if="${item.status == 0}">
                    <a th:data="${item.id}" class="layui-btn layui-btn-danger layui-btn-mini message_push"> <i
                    class="layui-icon">&#xe642;</i>推送</a>
                    <a th:data="${item.id}" class="layui-btn layui-btn-danger layui-btn-mini message_del"><i
                    class="layui-icon">&#xe640;</i> 删除</a>
                    </th:block>
                </td> -->
            </tr>
        </th:block>
        </tbody>
    </table>
</div>
<div id="paged" align="right"></div>
<script type="text/javascript" th:src="@{/layui/layui.js}"></script>
<script type="text/javascript" th:src="@{/jquery/jquery-3.2.1.min.js}"></script>
</body>
<script th:inline="javascript">
    layui.use(['laypage', 'form'], function () {
        var laypage = layui.laypage, $ = layui.jquery;
        //执行一个laypage实例
        laypage.render({
            elem: 'paged', //注意，这里的 test1 是 ID，不用加 # 号
            curr: [[${page.pageNum}]],
            count: [[${page.total}]], //数据总数，从服务端得到
            limit: [[${page.pageSize}]],
            layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'],
            jump: function (obj, first) {
                //得到了当前页，用于向服务端请求对应数据
                var curr = obj.curr;
                var limit = obj.limit;
                $("#pageSize").val(limit);
                $("#pageNum").val(curr);
                if (!first) {
                    $("#searchForm").submit();
                }
            }
        });
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功

        //……

        //但是，如果你的HTML是动态生成的，自动渲染就会失效
        //因此你需要在相应的地方，执行下述方法来手动渲染，跟这类似的还有 element.init();
        form.render();
        //导出excel
        $(".excel_btn").bind("click", function () {
            location.href = '/order/buyOrderExcel?' + $("#searchForm").serialize();
        });

    });

    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#startTime' //指定元素
            , type: 'datetime'
            , format: 'yyyy-MM-dd HH:mm:ss' //可任意组合
            , max: 1
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#endTime' //指定元素
            , type: 'datetime'
            , format: 'yyyy-MM-dd HH:mm:ss' //可任意组合
            , max: 1
        });
    });
</script>
</html>